package com.gmall.user.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gmall.model.user.UserInfo;
import com.gmall.user.mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserInfoService {


    @Autowired
    UserInfoMapper userInfoMapper;
    public UserInfo getUserInfoByLoginName(String loginName) {
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(UserInfo::getLoginName, loginName);
        List<UserInfo> userInfos = userInfoMapper.selectList(queryWrapper);
        if(userInfos.size()>0){
            return  userInfos.get(0);
        }
        return null;
    }
}
